package netTracker;

import java.io.Serializable;
import java.util.*;

public class Sequence implements Serializable{
	
	private static final long serialVersionUID = 1L;
	
	/** A hash map of patterns that represent song data.
	 * 	Patterns are stored by an index number. */
	HashMap<Integer, Pattern> patterns;
	/** Keeps track of the number of tracks in each pattern. */
	int numTracks;
	/** Keeps track of the number of cells in each pattern. */
	int numCells;
	Song song;
	
	/**
	 * Constructs an empty sequence.
	 * @param tracks The number of tracks.
	 * @param cells The number of cells in each track.
	 */
	public Sequence(int tracks, int cells, Song song){
		this.song=song;
		patterns = new HashMap<Integer, Pattern>();
		this.numTracks = tracks;
		this.numCells = cells;
		Pattern initialPattern = new Pattern(tracks, cells, this);
		patterns.put(0, initialPattern);
	}
	
	/** @return the patterns in the sequence. */
	public HashMap<Integer, Pattern> getPatterns(){
		return patterns;
	}

	/** @return the number of tracks. */
	public int getNumTracks() {
		return numTracks;
	}
	
	/** @return the number of cells. */
	public int getNumCells() {
		return numCells;
	}

	public double getTempo() {
		return song.getTempo();
	}
}
